package com.nchu.ft.controller;


import com.nchu.ft.common.domain.ApiResult;
import com.nchu.ft.entity.MaleMember;
import com.nchu.ft.service.MaleMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: MaleMemberController
 * @description:
 * @Author: Chuanwei Li
 * @CreateTime: 2025-08-17 15:55
 * @Version: 1.0
 */
@RestController
@RequestMapping("/maleMember")
public class MaleMemberController {

    @Autowired
    private MaleMemberService<MaleMember> maleMemberService;

    @PostMapping("/addMaleMember")
    public ApiResult<Boolean> addMaleMember(MaleMember maleMember) {
        return ApiResult.success(maleMemberService.save(maleMember));
    }

    @PostMapping("/updateMaleMember")
    public ApiResult<Boolean> updateMaleMember(MaleMember maleMember) {
        return ApiResult.success(maleMemberService.updateById(maleMember));
    }

    @PostMapping("/deleteMaleMember")
    public ApiResult<Boolean> deleteMaleMember(Integer id) {
        return ApiResult.success(maleMemberService.removeById(id));
    }

    @GetMapping("/getMaleMemberById")
    public ApiResult<MaleMember> getMaleMember(@RequestParam("maleMemberId") Integer maleMemberId) {
        return ApiResult.success(maleMemberService.getById(maleMemberId));
    }

    @GetMapping("/getMaleMemberList")
    public ApiResult<List<MaleMember>> getMaleMemberList() {
        return ApiResult.success(maleMemberService.list());
    }
}
